package com.xsy.android.compose.wandroid.ui.view.lce

import android.widget.ProgressBar
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import com.xsy.android.compose.wandroid.R

/**
 *@author: xiaosy
 *时间: 2024/7/11
 *@Description: java类作用描述
 *@Version: 1.0
 **/
@Composable
fun LoadingContent(modifier: Modifier = Modifier) {
    Column(
        modifier = modifier.fillMaxSize(),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        AndroidView(
            factory = { ProgressBar(it) }, modifier = Modifier
                .width(200.dp)
                .height(110.dp)
        ) {
            it.indeterminateDrawable = it.context.getDrawable(
                R.drawable.loading_animation
            )
        }
    }
}


@Preview(showBackground = true)
@Composable
private fun PreviewLoadingContent() {
    LoadingContent()
}